package com.pure.common.clone;

/**
 * @description:
 * @date: 2022-09-23 13:19
 * @since 1.2.0
 **/
class FatherClass implements Cloneable {

    public String name;

    public FatherClass(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public String toString() {
        return "FatherClass{" +
                "name='" + name + '\'' +
                '}';
    }
}

public class Milk implements Cloneable{
    public String name;
    public int weight;
    public String description;
    public FatherClass fatherClass;

    public Milk() {
    }

    public Milk(String name, int weight, String description, FatherClass fatherClass) {
        this.name = name;
        this.weight = weight;
        this.description = description;
        this.fatherClass = fatherClass;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public FatherClass getFatherClass() {
        return fatherClass;
    }

    public void setFatherClass(FatherClass fatherClass) {
        this.fatherClass = fatherClass;
    }

    @Override
    public Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public String toString() {
        return "Milk{" +
                "name='" + name + '\'' +
                ", weight=" + weight +
                ", description='" + description + '\'' +
                ", fatherClass=" + fatherClass +
                '}';
    }
}
